
    #if($initData.id)
    <input type="hidden" id="offer_id" name="offer_id" value="$initData.id">
    #else
    <input type="hidden" id="offer_id"  name="offer_id" value="">
    #end

    #if($initData.img_url)
    <input type="hidden"  id="img_url" name="img_url" value="$initData.img_url">
    #else
    <input type="hidden" id="img_url" name="img_url" value="">
    #end


    #if($initData.video_url)
    <input type="hidden" id="video_url" name="video_url" value="$initData.video_url">
    #else
    <input type="hidden" id="video_url"  name="video_url" value="">
    #end

    <div class="form-group">
        <label class="col-sm-3 control-label">商品名称：</label>
        <div class="col-sm-6">
            #if($initData.offer_name)
            <input type="text" id="offer_name" class="form-control" value="$initData.offer_name">
            #else
            <input type="text" id="offer_name" class="form-control" value="">
            #end
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label">商品价格：</label>
        <div class="col-sm-6">
            #if($initData.offer_price)
            <input type="text" id="offer_price" class="form-control" value="$d_offer_price">
            #else
            <input type="text" id="offer_price" class="form-control" value="">
            #end
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label">商品分类：</label>
        <div class="col-sm-6">
            <select id="offer_type">
                #foreach($type in $offerType)

                #if($initData.offer_type == $type.id)
                    <option value="$type.id" selected="selected">$type.type_name</option>
                #else
                    <option value="$type.id">$type.type_name</option>
                #end

                #end
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label">首页热销：</label>
        <div class="col-sm-6">
            <select id="is_hot">
                #if($initData.is_hot && $initData.is_hot ==1)
                    <option value="0" >否</option>
                    <option value="1" selected="selected">是</option>
                #else
                    <option value="0" selected="selected">否</option>
                    <option value="1" >是</option>
                #end
            </select>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-3 control-label"></label>
        <div class="col-sm-8">
            #if($initData.img_url)
            <img id="indexImg" src="$initData.img_url" style="width: 160px; height: 140px;">
            #else
            <img id="indexImg" src="" style="width: 160px; height: 140px;">
            #end
            <span style="color: red"> 默认大小512*512</span>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">商品封面图：</label>
        <div class="col-sm-6">


            <div class="col-sm-12 img-add" data-bind="visible: model.formEntity.bannerImgurl().length < 1">


                    <a class="btn btn-default btn-lg " id="pickfiles"  >
                        <i class="glyphicon glyphicon-plus"></i>
                        <span>选择图片文件</span>
                    </a>

            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label"></label>
        <div class="col-sm-9" id="video_list">

            <!--<img id="indexVideo" src="" style="width: 160px; height: 140px;">-->
            #if($initData.vedio_url)
            <video id="indexVideo" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"  data-setup="{}">

                <source src="$initData.vedio_url" type="video/mp4">
           </video>
            #end
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label">商品视频：</label>
        <div class="col-sm-6">
            <ul class="img-list col-sm-12" id="videoList">
                #if($initData.video_url)
                <li><img src='$initData.video_url'></li><i></i>
                #end
            </ul>

            <div class="col-sm-12 img-add" data-bind="visible: model.formEntity.bannerImgurl().length < 1">
                <div id="container">
                    <a class="btn btn-default btn-lg " id="pickfiles2"  >
                        <i class="glyphicon glyphicon-plus"></i>
                        <span>选择视频文件</span>
                    </a>
                </div>

            </div>
        </div>
    </div>

    #if($initData.offer_detail)
    <div class="form-group">
        <label class="col-sm-3 control-label">商品内容：</label>
        <div class="col-sm-9">
            <div id="editor-trigger">$initData.offer_detail</div>
        </div>
    </div>

    #else
    <div class="form-group">
        <label class="col-sm-3 control-label">商品内容：</label>
        <div class="col-sm-9">
            <div id="editor-trigger"></div>
        </div>
    </div>
    #end

<script >

    var editor = new wangEditor('editor-trigger');

    // 上传图片
    editor.config.uploadImgUrl = '/upload';
    editor.config.uploadParams = {
        // token1: 'abcde',
        // token2: '12345'
    };
    editor.config.uploadHeaders = {
        // 'Accept' : 'text/x-json'
    }
    // editor.config.uploadImgFileName = 'myFileName';

    // 隐藏网络图片
    // editor.config.hideLinkImg = true;

    // 表情显示项
    editor.config.emotionsShow = 'value';


    // onchange 事件
    editor.onchange = function () {
        console.log(this.$txt.html());
    };

    editor.create();
</script>


<script src="/newshop/offer/goods/addgoods.js"></script>